#include <stdio.h>
//#include "laserfield.h"
//#include "gridobject.h"
//#include "constants.h"


void CalculaRo(vector<double> &_xp, grid_object &_ro,vector<double> &_qp,double _deltag, int _na, FILE *fp0);
void CalculaJ(int _label, vector<double> &_xp,vector<double> &_vpx, vector<double> &_vpy,vector<double> &_vpz, grid_object &_Jx,grid_object &_Jy,grid_object &_Jz,vector<double> &_qp,double _deltat,double _deltag, int _na, FILE *fp0, FILE *fp1);

double E0x(double _xg, double _t);
double E0y(double _xg,double _t,double _xgleft, laser &_laser0);
double E0z(double _xg, double _t);
double B0x(double _xg,double _t);
double B0y(double _xg,double _t);
double B0z(double _xg,double _t,double _xgleft, laser _laser0);
void CalculaEx(grid_object & _Ex, grid_object & _Phi, grid_object & _DAx, double _t,double _deltat, FILE *fp0);
void CalculaEy(grid_object & _Ey, grid_object & _DAy,double _t,double _deltat, double _xg,double _xgleft,laser &_laser0);
void CalculaEz(grid_object & _Ez, grid_object & _DAz,double _t,double _deltat);
void CalculaBy(grid_object & _By, grid_object & _Az ,double _t,double _deltat);
void CalculaBz(grid_object & _Bz, grid_object & _Ay ,double _t,double _deltat,double _xg,double _xgleft, laser &_laser0); 
void interpola(double _x,grid_object & _Ex,grid_object & _Ey,grid_object & _Ez,grid_object & _By,grid_object & _Bz,double &_Epx,double &_Epy,double &_Epz,double &_Bpx,double &_Bpy,double &_Bpz, double _t,int _ndg,double _deltag, int _na, FILE *fp0);
void ParticleMover(double &_xp, double &_vpx,double &_vpy, double &_vpz, double _Epx,double _Epy,double _Epz,double _Bpx,double _Bpy,double _Bpz, double _deltat, double ae);
void CalculaPotenciales(grid_object & _phi, grid_object & _Ax, grid_object & _Ay, grid_object & _Az, grid_object & _Axold, grid_object & _Ayold, grid_object & _Azold, grid_object & _DAx, grid_object & _DAy, grid_object & _DAz, grid_object & _Jx, grid_object & _Jy, grid_object & _Jz,grid_object & _IntJx, grid_object & _IntJy, grid_object & _IntJz, grid_object & _Ro, grid_object & _IntRo, grid_object & _Rop, grid_object & _Roold, grid_object & _Ropold, grid_object & _IAxM, grid_object & _IAyM, grid_object & _IAzM, grid_object & _IAxP, grid_object & _IAyP, grid_object & _IAzP, grid_object & _IPhiM, grid_object & _IPhiP, double _deltat, FILE *fp0);
void CalculaCamposInternos(grid_object & _Ex, grid_object & _Ey, grid_object & _Ez, grid_object & _By, grid_object & _Bz, grid_object & _Jx, grid_object & _Jy, grid_object & _Jz, grid_object & _Fp, grid_object & _Fm, grid_object & _Gp, grid_object & _Gm,  double _t,double _deltat, double _xgleft, laser _laser0, FILE *fp0);



//Start with the object version supposedly more compact

/*double oE0y(double _xg,double _t,double _xgleft, laser _laser1);
void oCalculaRo(grid_object & _xp, int _npion, grid_object & _ro ,grid_object & _qp, int _na, FILE *fp0);
void oCalculaRo_history(grid_object & _xp, int _npion, grid_object & _ro[], grid_object & _qp[], int _na, FILE *fp0,int _n);
void oCalculaJ(int _label, double _xp[],grid_object & _vp[],int _npion, grid_object & _J[], grid_object & _qp, int _na, FILE *fp0);

double oE0x(double _xg, double _t);
double oE0y(double _xg,double _t,double _xgleft, laser laser1);
double oE0z(double _xg, double _t);
double oB0x(double _xg,double _t);
double oB0y(double _xg,double _t);
double oB0z(double _xg,double _t,double _xgleft, laser laser1);
void oCalculaEx(grid_object & _Ex, grid_object & _Phi, grid_object & _DAx, grid_object & _t);
void oCalculaEy(double _Ey[],double _DAy[],int _ndg,double _t,double _deltag,double _deltat, double _xg,double _xgleft, laser _laser1);
void oCalculaEz(double _Ez[],double _DAz[],int _ndg, double _t,double _deltag,double _deltat);
void oCalculaBy(double _By[],double _Az[], int _ndg, double _t,double _deltag,double _deltat);
void oCalculaBz(double _Bz[],double _Ay[],int _ndg,double _t,double _deltag,double _deltat,double _xg,double _xgleft, laser _laser1);
void ointerpola(double _x,double _Ex[],double _Ey[],double _Ez[],double _By[],double _Bz[],double _Epx,double _Epy,double _Epz,double _Bpx,double _Bpy,double _Bpz, double _t,int _ndg,double _deltag, int _na);
*/
